﻿using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Input;
using Helper;

namespace Starehe.ViewModels
{

    public class BackupVM : ViewModelBase
    {
        string backupPath;
        public BackupVM()
        {
        }

        protected override void InitVars()
        {
            throw new System.NotImplementedException();
        }
        public ICommand CreateBackupCommand
        {
            get;
            private set;
        }
        public ICommand BrowseCommand
        {
            get;
            private set;
        }
        protected override void CreateCommands()
        {
            CreateBackupCommand = new RelayCommand(o =>
            {
                bool gy = DataAccessHelper.CreateDefaultDbBackup(this.BackupPath);
                Helper.Properties.Settings.Default.MostRecentBackup = BackupPath;

            }, o => true);

            BrowseCommand = new RelayCommand(o =>
            {
                BackupPath = FileHelper.SaveFileAsGz();
            }, o => true);
        }

        public string BackupPath
        {
            get { return this.backupPath; }

            set
            {
                if (value != this.backupPath)
                {
                    this.backupPath = value;
                    NotifyPropertyChanged("BackupPath");
                }
            }
        }

        public override void Reset()
        {
            throw new System.NotImplementedException();
        }
    }
}
